<?php
declare(strict_types=1);
namespace app\api\service;
use app\common\model\ShortUrlModel;
use Php127\Douyin\Factory;;

class MessageService extends CommonService
{
    public function initMessage(array $params): array
    {
        switch ($params['event']){
            case "EventFriendMsg"://私人聊天
                (new FriendService())->friendData($params);
                break;
            case "EventGroupMsg"://群消息
                (new GroupService())->message($params);
                break;
            case "EventReceivedTransfer"://好友微信转账
                break;
            case "EventScanCashMoney"://二维码收款
                break;
            case "EventFriendVerify"://好友请求
                (new FriendService())->addFriend($params);
                break;
            case "EventGroupMemberAdd"://新人进群
                (new GroupService())->addMember($params);
                break;
            case "EventGroupMemberDecrease"://有人退群
                (new GroupService())->outMember($params);
                break;
            case "EventSysMsg"://系统消息
                break;
            case "EventSendOutMsg":
                (new SendOutService())->shunt($params);
                break;
        }
        return successJson();
    }

    public function sendTest(array $params){
        $data['event'] = 'GetFriendList';
        $data['robot_wxid'] = 'wxid_xmyit5wjvewv22';
        $data['robot_wxid'] = '17386856228@chatroom';
        return $this->invite_in_group($this->API_URL,$data);
    }

 public function aa(){
        $this->send_music_msg('wxid_xmyit5wjvewv22','19682652069@chatroom','晚安');

 }


}